package com.hmall.controller;

import com.hdmall.business.common.annotation.LoginRequired;
import com.hdmall.business.common.common.ServerResponse;
import com.hmall.mapper.SysDeptCustomerMapper;
import com.hmall.model.SysUser;
import com.hmall.service.UserService;
import com.hdmall.business.common.util.ImageRecog;
import com.hmall.util.TokenUtil;
import com.hmall.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

/**
 * @Author  zhoutao
 * @Date 2018/11/8 16:31
 * @Param
 * @return
 * @Description // 用户接口
 */
@Slf4j
@RestController
@RequestMapping("/user/")
@Api(value = "用户操作API", description = "用户注册登陆类API说明")
public class UserController {

    private final UserService userService;

    private final SysDeptCustomerMapper sysDeptCustomerMapper;

    private final JedisPool jedisPool;

    TokenUtil tokenUtil = new TokenUtil();

    private static final String PC_CLIENT_ID = "101481103";

    private static final String H5_CLIENT_ID = "101487590";

    private static final String WECHAT_APPID = "wx6b8a43d0d2c82d62";

    private static final String WECHAT_SECRET = "93300585b0fa657d78f59aba303cbfd7";

    private final static String USER_INFO_URL = "https://graph.qq.com/user/get_user_info";

    private final static String USER_INFO_API = "%s?access_token=%s&oauth_consumer_key=%s&openid=%s";

    private final static String USER_WECHAT_URL = "https://api.weixin.qq.com/sns/oauth2/access_token";

    private final static String USER_WECHAT_API = "?appid=%s&secret=%s&code=%s&grant_type=%s";


    @Autowired
    public UserController(UserService userService, SysDeptCustomerMapper sysDeptCustomerMapper, JedisPool jedisPool) {
        this.userService = userService;
        this.sysDeptCustomerMapper = sysDeptCustomerMapper;
        this.jedisPool = jedisPool;
    }


    /**
     * @Date 2018/11/8 16:32
     * @Param [token]
     * @return com.hmall.common.ServerResponse
     * @Description // 个人中心额外信息——手机端
     */
    @LoginRequired
    @GetMapping(value = "get_extra_information")
    @ApiOperation(value = "手机端个人详细信息", notes = "提供拿样申请数目：sampleCount，欠款额度：arrears，积分兑换：exchange，待评论：needComment，我的收藏：collection，代金卷：coupon，用户vip， repuration:信誉, date:代金卷过期日期等")
    public ServerResponse getExtraInformation(String token) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getExtraInformation(user.getUserId());
    }

    /**
     * @Date 2018/11/8 16:32
     * @Param [token]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.PCUserInformationVo>
     * @Description // 详尽个人中心——PC端
     */
    @LoginRequired
    @GetMapping(value = "get_detial_information_basic")
    @ApiOperation(value = "PC端个人中心基础信息")
    public ServerResponse<PCUserInformationVo> getDetialInformation(String token) throws Exception{

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getDetialInformation(user.getUserId());
    }

    /**
     * @Date 2018/11/8 16:32
     * @Param [token, pageSize, pageNum]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.PageVo>
     * @Description // 详情个人中心(拿样)
     */
    @LoginRequired
    @GetMapping(value = "get_detial_information_sample")
    @ApiOperation(value = "PC端个人中心拿样信息")
    public ServerResponse<PageVo<SampleVo>> getDetialInformationSample(String token, @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize,
                                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) throws Exception{

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();

        return  userService.getDetailInformationSample(user.getUserId(), pageNum, pageSize);
    }

    /**
     * @Date 2018/11/8 16:32
     * @Param []
     * @return com.hmall.common.ServerResponse<com.hmall.vo.ProductCommend>
     * @Description // 详情个人中心(每日推荐)
     */
    @GetMapping(value = "get_detial_information_recommend")
    @ApiOperation(value = "PC端个人中心每日推荐")
    public ServerResponse<ProductCommend> getDetailInformationRecommed() {

        return userService.getDetailInformationRecommend();
    }

    /**
     * @Date 2018/11/8 16:32
     * @Param [token, pageNum, pageSize]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.PageVo>
     * @Description // 会员推荐
     */
    @LoginRequired
    @GetMapping(value = "get_detial_information_vip")
    @ApiOperation(value = "PC端个人中心会员产品推荐")
    public ServerResponse<PageVo<ProductVip>> getDetialInformationVip(String token, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                      @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize) throws  Exception{

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getDetailInformationVip(pageNum, pageSize);
    }

    /**
     * @Date 2018/11/8 16:33
     * @Param [token]
     * @return com.hmall.common.ServerResponse
     * @Description // 个人收藏
     */
    @LoginRequired
    @GetMapping(value = "get_detial_information_favorite")
    @ApiOperation(value = "PC端个人中心收藏")
    public ServerResponse getDetialInformationFavorite(String token) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getInformationFavorite(user.getUserId());
    }


    /**
     * @Date 2018/11/8 16:33
     * @Param [rabbitKey]
     * @return com.hmall.common.ServerResponse
     * @Description //
     *   1.建立链接
     *   2.返回用来生成二维码的字符串
     */
    @PostMapping(value = "createQRCode")
    @ApiOperation(value = "二维码生成", notes = "用以PC端生成二维码字符串，提供给移动端")
    public ServerResponse createQRCode(String rabbitKey){

        return userService.createQRcode(rabbitKey);
    }

    /**
     * @Date 2018/11/8 16:33
     * @Param [QRCode, token]
     * @return com.hmall.common.ServerResponse
     * @Description // 接受手机端的二维码验证
     */
    @LoginRequired
    @PostMapping("checkQRCode")
    @ApiOperation(value = "二维码登录验证", notes = "移动端传过来生成的二维码串以及手机端上的token，验证通过后，存储到PC页面上")
    public ServerResponse checkQRCode(String QRCode, String token, String deviceToken) throws Exception {

        return userService.checkQRCode(QRCode, token);
    }

    @RequestMapping(value = "login", method = RequestMethod.POST)
    @ApiOperation(value = "用户登陆", notes = "2019/1/10 重复推送原因加了唯一机器信息deviceToken")
    public ServerResponse<LoginUserVo> login(HttpServletRequest request, String username, String password, String deviceToken) {

        return userService.login(request, username, password, deviceToken);
    }

    @GetMapping("checkLogin")
    @ApiOperation(value = "判断是否有用户已经登录", notes = "带PC-,IOS-,ANDROID-")
    public ServerResponse checkLogin(String username){

        return userService.checkLogin(username);
    }


    /**
     * @Date 2018/11/8 16:33
     * @Param [accessToken, openId]
     * @return com.hmall.common.ServerResponse
     * @Description // H5第三方
     */
    @PostMapping(value = "H5_QQ_login")
    @ApiOperation(value = "H5端QQ第三方登录")
    public ServerResponse H5QQLogin(String accessToken, String openId) {

        String url = String.format(USER_INFO_API, USER_INFO_URL, accessToken, H5_CLIENT_ID, openId);
        return userService.qqLogin(url);
    }


    /**
     * @Date 2018/11/8 16:37
     * @Param [accessToken, openId]
     * @return com.hmall.common.ServerResponse
     * @Description // pc第三方
     */
    @PostMapping(value = "PC_QQ_login")
    @ApiOperation(value = "PC端QQ第三方登录")
    public ServerResponse pcQQlogin(String accessToken, String openId) {
        String url = String.format(USER_INFO_API, USER_INFO_URL, accessToken, PC_CLIENT_ID, openId);

        return userService.qqLogin(url);
    }

    @PostMapping(value = "WECHAT_login")
    @ApiOperation(value = "微信第三方登录", notes = "为了获取用户信息和openId")
    public ServerResponse weChatLogin(String code){
//        String url = String.format(USER_WECHAT_URL,USER_WECHAT_API, WECHAT_APPID, WECHAT_SECRET, code, "authorization_code");
        String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + WECHAT_APPID + "&secret=" + WECHAT_SECRET +
                "&code=" + code + "&grant_type=authorization_code";
        return userService.weChatLogin(url);
    }






    /**
     * @Date 2018/11/8 16:38
     * @Param [username, deviceToken]
     * @return com.hmall.common.ServerResponse
     * @Description // 华为deviceToken信息存储
     */
    @GetMapping(value = "huaWei_token_register")
    @ApiOperation(value = "华为deviceToken信息存储")
    public ServerResponse huaWeiTokenRegister(String username, String deviceToken){

        return userService.huaWeiTokenRegister(username, deviceToken);
    }




   /**
    * @Date 2018/11/8 16:39
    * @Param [qqOpenId, weChatOpenId, nickName, avator, agent]
    * @return com.hmall.common.ServerResponse
    * @Description //
    *   第三方登录
    *   如果传过来的openId和type在已经和手机绑定了，帮助登录
    */
    @PostMapping(value = "third_login")
    @ApiOperation(value = "第三方登录", notes = "nickName:昵称,avator,头像;agent:设备信息，ANDROID- 或 IOS-")
    public ServerResponse thirdLogin(String qqOpenId, String weChatOpenId, String agent, String deviceToken) throws IOException {

        return userService.thirdLogin(qqOpenId, weChatOpenId, agent, deviceToken);
    }

    /**
     * @Date 2018/11/8 16:39
     * @Param [qqOpenId, weChatOpenId, tel, nickName, avator, agent, core]
     * @return com.hmall.common.ServerResponse
     * @Description //
     * 绑定手机
     * 该第三方账号未绑定手机
     * 1.手机号已经注册 使用原来的头像和昵称信息， 帮助用户登录
     * 2.手机号未注册  更新头像和昵称信息  帮助用户的注册和登录
     */
    @PostMapping(value = "tel_binding")
    @ApiOperation(value = "第三方账号绑定手机",notes = "agent:设备信息， ANDROID- 或 IOS-,WECHAT-， core：验证码")
    public  ServerResponse bindingTel(String qqOpenId, String weChatOpenId, String tel, String nickName, String avator, String agent, String core, String deviceToken){

        return userService.telBinding(qqOpenId, weChatOpenId, tel, nickName, avator, agent, core);
    }

    @LoginRequired
    @RequestMapping(value = "logout", method = RequestMethod.POST)
    @ApiOperation(value = "用户登出")
    public  ServerResponse<String> logout(String token) throws Exception {

        return userService.logout(jedisPool, token);
    }



    @RequestMapping(value = "register", method = RequestMethod.POST)
    @ApiOperation(value = "用户注册")
    public ServerResponse register(SysUser user) {

        return userService.register(user);
    }


    @Deprecated
    @PostMapping(value = "subRegister")
    @ApiOperation(value = "后台主动帮助商铺注册前端账户")
    public ServerResponse subRegister(String username, @RequestParam(value = "password", defaultValue = "123456") String password){

        SysUser user = new SysUser();
        user.setUsername(username);
        user.setPassword(password);
        return userService.subRegister(user);
    }


    @RequestMapping(value = "check_valid", method = RequestMethod.POST)
    @ApiOperation(value = "用户有效性检查")
    public ServerResponse<String> checkValid(String userName) {
        return userService.checkValid(userName);
    }

    @GetMapping(value = "bind_check_valid")
    @ApiOperation(value = "校验是否手机已经绑定了QQ或者微信",notes = "type:类型 填写QQ或者WeChat")
    public ServerResponse bindCheckValid(String userName, String type){
        return userService.bindCheckValid(userName, type);
    }


    /**
     * @Date 2018/11/8 16:46
     * @Param [token]
     * @return com.hmall.common.ServerResponse<java.util.Map<java.lang.String,java.lang.String>>
     * @Description //
     * 用来判断是否资质通过
     * 资质通过 返回状态 3
     */
    @LoginRequired
    @RequestMapping(value = "get_user_info", method = RequestMethod.POST)
    @ApiOperation(value = "用来校验token")
    public ServerResponse<Map<String, String>> getUserInfo(String token) throws Exception {

        SysUser user  = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getUser(user.getUserId());
    }

    @LoginRequired
    @PostMapping("update_information")
    @ApiOperation(value="用户信息更新")
    public ServerResponse<SysUser> updateInformation(SubUserInfoVo subUserInfoVo, String token) throws Exception{

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.updateInformation(subUserInfoVo, user.getUserId());
    }

    @LoginRequired
    @GetMapping("get_information")
    @ApiOperation(value="获取用户信息")
    public ServerResponse<UserInfoVo> getInformation(HttpServletRequest request, String token) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getInformation(request, user.getUserId());
    }

    /**
     * @Date 2018/11/8 16:46
     * @Param [token]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.UnitContactVo>
     * @Description // 获取用户发票
     */
    @LoginRequired
    @GetMapping("select_invoice")
    @ApiOperation(value="获取用户发票")
    public ServerResponse<UnitContactVo> selectInvoice(String token) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.selectInvoiceByUser(user.getUserId());
    }


    /**
     * @Date 2018/11/8 16:46
     * @Param [userName, code, newPassword]
     * @return com.hmall.common.ServerResponse
     * @Description // 短信密码重置
     */
    @PostMapping("tel_password_reset")
    @ApiOperation("短信密码找回")
    public ServerResponse resetPassword(String userName, String code, String newPassword) {

        Jedis jedis = jedisPool.getResource();
        ServerResponse response =  userService.resetPassword(jedis, userName, code, newPassword);
        jedis.close();
        return response;
    }
    @LoginRequired
    @GetMapping("getTempPrefectInformation")
    @ApiOperation("获取用户提交的资质信息")
    public ServerResponse getTempPrefectInformation(String token) throws Exception {
        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getTempPrefectInformation(user.getUserId());

    }


    /**
     * @Date 2018/11/8 16:46
     * @Param [token, sysUserTempVo]
     * @return com.hmall.common.ServerResponse
     * @Description // 用户信息完善
     */
    @LoginRequired
    @PostMapping("prefectInformation")
    @ApiOperation(value = "完善用户信息", notes = "提交用户的一些身份证信息，企业授权信息等进行资质认证，提交类型String 买家或者卖家")
    public ServerResponse prefectInformation(String token, SysUserTempVo sysUserTempVo) throws Exception {

        sysUserTempVo.setType("买家");
        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        int userId = user.getUserId();
        return userService.prefectInformation(sysUserTempVo, userId);
    }

    /**
     * @Date 2018/11/8 16:46
     * @Param [token]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.SysUserDetailVo>
     * @Description // 展示用户资质信息
     */
    @LoginRequired
    @GetMapping("getPerfectInformation")
    @ApiOperation("显示用户资质信息")
    public ServerResponse<SysUserDetailVo> getPerfectInformation(String token) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getPerfectInformation(user.getUserId());

    }

   @PostMapping("imgLegalId")
    @ApiOperation("测试身份证识别")
    public ServerResponse imgLegalId(String url, String config) throws Exception {

//        String str="http://47.98.213.218:3333/api/resouces/2018551357321abb2dc3d76311944ffdbe9980fbaadd.jpg";
        ImageRecog.imgLegalId(url, config);
        return ServerResponse.createBySuccess();
    }

    @PostMapping("imgLicense")
    @ApiOperation("测试营业执照识别")
    public ServerResponse imgLicense(String url) throws Exception {

        ImageRecog.imgLicense(url);
        return ServerResponse.createBySuccess();
    }

    /**
     * @Date 2018/11/8 16:46
     * @Param [token, subName]
     * @return com.hmall.common.ServerResponse<java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>
     * @Description // 模糊查询公司的信息 不能有子节点
     */
    @LoginRequired
    @GetMapping("queryCompany")
    @ApiOperation("模糊查询无子节点的公司信息")
    public ServerResponse<List<Map<String, Object>>> queryCompany(String token, String subName){

        return userService.queryCompany(subName);
    }

    /**
     * @Date 2018/11/8 16:45
     * @Param [token, oldPassword, newPassword]
     * @return com.hmall.common.ServerResponse
     * @Description // 修改密码
     *     办事处和普通用户
     */
    @LoginRequired
    @PostMapping("changePassword")
    @ApiOperation("修改密码")
    public ServerResponse changePassword(String token, String oldPassword, String newPassword) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.changePassword(user.getUserId(), oldPassword, newPassword);
    }

    //传递-1 表示所有月份

    /**
     * @Date 2018/11/8 16:45
     * @Param [token, customerId, year, month, type]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.StatementOfAccountVo>
     * @Description // 对账单列表
     */
    @LoginRequired
    @GetMapping("getStatementOfAccountUp")
    @ApiOperation(value = "得到对账单列表上部分货款信息", notes = "不传递月份，默认当前月份；不传递年份，默认当前年份 0表示现金凭证 1表示账期凭证|2018/9/18新增支持办事处接口，传递customerId指定公司")
    public ServerResponse<StatementOfAccountVo> getStatementOfAccountUp(String token, Integer customerId, Integer year, Integer month, @RequestParam(value = "type", defaultValue = "1") Integer type) throws Exception {

//        Integer allCheck = 0;
//        int tMonth = -1;
//        int tYear = -1 ;
//        //默认当前月份当前年份
//        if(-1 == year && -1 == month) {
//            allCheck = 1;

            Calendar calendar = Calendar.getInstance();
            Integer tMonth = calendar.get(Calendar.MONTH);
            if (null != month) {
                tMonth = month - 1;
            }
            Integer tYear = calendar.get(Calendar.YEAR);
            if (null != year) {
                tYear = year;
            }


        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
            if(null == customerId) {
                customerId = sysDeptCustomerMapper.selectCustomerIdByCustomerUserId(user.getUserId());
            }
//        List<Integer> customerIdList = new ArrayList<>();
//        customerIdList = getCustomerIdListByArgs(token, customerId, type);
        return userService.getStatementOfAccountUp(customerId, tYear, tMonth);
    }
    @LoginRequired
    @GetMapping("getStatementOfAccountDown")
    @ApiOperation(value = "得到对账单列表下部分凭证列表", notes = "分页 默认当前月份；不传递年份，默认当前年份 0表示现金凭证 1表示账期凭证|2018/9/18新增支持办事处接口，传递customerId指定公司")
    public ServerResponse<PageVo<PaymentVoucherVo>> getStatementOfAccountDown(String token, Integer customerId, Integer year, Integer month, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(value = "type", defaultValue = "1") Integer type) throws Exception {

        //默认当前月份当前年份
        Calendar calendar = Calendar.getInstance();
        int tMonth = calendar.get(Calendar.MONTH);
        if(null != month){
            tMonth = month - 1;
        }
        int tYear = calendar.get(Calendar.YEAR);
        if(null != year){
            tYear = year;
        }

        List<Integer> customerIdList;
        customerIdList = getCustomerIdListByArgs(token, customerId, type);
        return userService.getStatementOfAccountDown(customerIdList, tYear, tMonth, pageNum, pageSize);
    }



    /**
     * @Date 2018/11/8 16:43
     * @Param [token, customerId, year, type]
     * @return com.hmall.common.ServerResponse<java.util.List<com.hmall.vo.AccountHistoryVo>>
     * @Description // 对账单历史记录
     */
    @LoginRequired
    @GetMapping("getStatementOfAccountHistory")
    @ApiOperation(value = "得到对账单历史主列表")
    public ServerResponse<List<AccountHistoryVo>> getStatementOfAccountHistory(String token, Integer customerId, Integer year, @RequestParam(value = "type", defaultValue = "1")Integer type) throws Exception {

        Calendar calendar = Calendar.getInstance();
        int tYear = calendar.get(Calendar.YEAR);
        if(null != year){
            tYear = year;
        }

        List<Integer> customerIdList;
        customerIdList = getCustomerIdListByArgs(token, customerId, type);

        return userService.getStatementOfAccountHistory(customerIdList, tYear);
    }

    @GetMapping("getYearList")
    @ApiOperation(value = "得到年份列表",notes = "手机端需要，暂时上下两年")
    public ServerResponse<List<Integer>> getYearList(){

        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        List<Integer> yearList = new ArrayList<>();
        for(int i = -2; i <= 2; i++){
            yearList.add(i + year);
        }
        return ServerResponse.createBySuccess(yearList);
    }
    @LoginRequired
    @GetMapping("getStatementOfAccountOrderDetial")
    @ApiOperation(value = "得到对账单历史订单明细", notes = "不传递默认当前年份当前月份，内部发货列表请求order项目下的getOrderFufillmentList|2018/9/18新增支持办事处接口，传递customerId指定公司")
    public ServerResponse<List<AccountOrderVo>> getStatementOfAccountOrderDetail(String token, Integer customerId, Integer year, Integer month, @RequestParam(value = "type", defaultValue = "1") Integer type) throws Exception {

        //默认当前月份当前年份
        Calendar calendar = Calendar.getInstance();
        int tMonth = calendar.get(Calendar.MONTH);
        if(null != month){
            tMonth = month - 1;
        }
        int tYear = calendar.get(Calendar.YEAR);
        if(null != year){
            tYear = year;
        }

       List<Integer> customerIdList = getCustomerIdListByArgs(token, customerId, type);
        return userService.getStatementOfAccountOrderDetail(customerIdList, tYear, tMonth);
    }



    /**
     * @Date 2018/11/8 16:42
     * @Param [token, customerId, type]
     * @return java.util.List<java.lang.Integer>
     * @Description // 得到customerIdList
     */
    @LoginRequired
    private List<Integer> getCustomerIdListByArgs(String token, Integer customerId, Integer type) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getCustomerUserIdByArgs(user.getUserId(), customerId, type);
    }



    /**
     * @Date 2018/11/8 16:42
     * @Param [token]
     * @return com.hmall.common.ServerResponse<com.hmall.vo.InvoiceVo>
     * @Description // 我的开票信息
     */
    @LoginRequired
    @GetMapping("getInvoiceInformation")
    @ApiOperation(value = "得到发票信息")
    public ServerResponse<InvoiceVo> getInvoiceInformation(String token) throws Exception {

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.getInvoiceInformation(user.getUserId());
    }

    /**
     * @Date 2018/11/8 16:42
     * @Param [token, invoiceReceivemanName, invoiceReceivemanTel, invoiceReceivemanAddress]
     * @return com.hmall.common.ServerResponse
     * @Description // 更新发票信息
     */
    @LoginRequired
    @PostMapping("updateInvoiceInformation")
    @ApiOperation(value = "更新发票联系人信息")
    public ServerResponse updateInvoiceInformation(String token, String invoiceReceivemanName, String invoiceReceivemanTel, String invoiceReceivemanAddress) throws Exception{

        SysUser user = tokenUtil.tokenToUser(jedisPool, token).getData();
        return userService.updateInvoiceInformation(user.getUserId(), invoiceReceivemanName, invoiceReceivemanTel, invoiceReceivemanAddress);
    }





}
